package com.example.kotlin.basis

/**
 * Created by xiao_tan on 17/7/23.
 * 函数和函数式表达式
 */

fun main(args: Array<String>) {
    println(com.example.kotlin.basis.add(3, 5))
    println(com.example.kotlin.basis.add2(4, 5))

    var i = { x: Int, y: Int -> x + y }
    var resultI = i(5, 6)
    println(resultI)

    var j: (Int, Int) -> Int = { x, y -> x + y }
    var resultJ = j(6, 7)
    println(resultJ)
}

fun add(a: Int, b: Int): Int {
    return a + b
}

fun add2(a: Int, b: Int): Int = a + b
